
<div class="layuimini-container">
    <form id="app-form" class="layui-form layuimini-form">
        <div class="layui-form-item">
            <label class="layui-form-label">分类名称</label>
            <div class="layui-input-block">
                <input type="text" name="title" class="layui-input" placeholder="请输入分类名称" value="">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label required">图片</label>
            <div class="layui-input-block layuimini-upload">
                <input name="image" class="layui-input layui-col-xs6" readonly  placeholder="请上传图片" value="">
                <div class="layuimini-upload-btn">
                    <span><a class="layui-btn" data-upload="image" data-upload-number="one" data-upload-exts="png|jpg|ico|jpeg" data-upload-icon="image"><i class="fa fa-upload"></i> 上传</a></span>
                </div>
            </div>
        </div>
        <!-- <div class="layuimini-container">
            <form id="app-form" class="layui-form layuimini-form" enctype="multipart/form-data" method='GET'>
              
                <div class="layui-form-item  layui-row layui-col-xs12">
                    <label class="layui-form-label required">上传Excel</label>
                    <div class="layui-input-block">
                        <button type="button" class="layui-btn" id="test3"><i class="layui-icon"></i>上传文件</button>
                  
                    </div>
                </div>
            
            </form>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label ">导出</label>
            <div class="layui-input-block layuimini-upload">
                <div class="layuimini-upload-btn"></div>
                    <button type="button"  class="layui-btn" id="xiazai">导出</button>
                </div>
            </div>
        </div> -->
      
        <div class="hr-line"></div>
        <div class="layui-form-item text-center">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
        </div>
    </form>
</div>
<script type="text/javascript">
    layui.use(['form','upload'], function(){
        var form = layui.form;
        var upload = layui.upload;
        $ = layui.$;
        //各种基于事件的操作。
        //常规使用 - 普通图片上传
        var uploadInst = upload.render({
            elem: '#test3'
            , url: 'importOrder' //此处配置你自己的上传接口即可
            , accept: 'file' //普通文件
            , before: function (obj) {
                layer.msg('上传中', { icon: 16, time: 0 });
            }
            , done: function (res) {
                layer.msg(res.msg);
                //如果上传失败
                // if (res.code > 0) {
                //     return layer.msg('上传失败');
                // }
                // //上传成功的一些操作
                // //……
                // $('#demoText').html(''); //置空上传失败的状态
            }
            , error: function () {
                //演示失败状态，并实现重传
                // var demoText = $('#demoText');
                // demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
                // demoText.find('.demo-reload').on('click', function () {
                //     uploadInst.upload();
                // });
                return layer.msg('上传失败，网络异常');
            }
            //进度条
            , progress: function (n, elem, e) {
                element.progress('demo', n + '%'); //可配合 layui 进度条元素使用
                if (n == 100) {
                    layer.msg('上传完毕');
                }
            }
        });

        $('#xiazai').click(function(){
            window.location.href = "export";
        })

    });
</script>